package nil.ed.simulator.request.guice.event;

import com.google.inject.AbstractModule;
import com.google.inject.multibindings.Multibinder;
import nil.ed.simulator.request.biz.qq.listener.*;
import nil.ed.simulator.request.event.bus.EventBus;
import nil.ed.simulator.request.event.bus.EventListener;
import nil.ed.simulator.request.event.bus.StandardEventBus;
import nil.ed.simulator.request.ui.jfx.event.*;

/**
 * 展示层模块对象.
 * @author lidelin.
 */
public class EventModule extends AbstractModule {

    @Override
    protected void configure() {
        bind(EventBus.class).to(StandardEventBus.class);
        Multibinder<EventListener> listeners = Multibinder.newSetBinder(binder(), EventListener.class);
        // activity
        listeners.addBinding().to(StartActivityListener.class).asEagerSingleton();
        listeners.addBinding().to(QqItemScheduleUnitFinishListener.class).asEagerSingleton();
        listeners.addBinding().to(ExportCookieListener.class).asEagerSingleton();
        listeners.addBinding().to(CookieStoreEventListener.class).asEagerSingleton();

        // ui
        listeners.addBinding().to(QqParseSuccessListener.class).asEagerSingleton();
        listeners.addBinding().to(ImportQqFileLister.class).asEagerSingleton();
        listeners.addBinding().to(QqTaskFinishListener.class).asEagerSingleton();
        listeners.addBinding().to(ExportCookieTaskResultListener.class).asEagerSingleton();
        listeners.addBinding().to(NeedVcEventListener.class).asEagerSingleton();
        listeners.addBinding().to(LoginSuccessOrFailedEventListener.class).asEagerSingleton();
        listeners.permitDuplicates();
    }

}
